<?php // Change the css classes to suit your needs    
$query = $this->db->query("SELECT * FROM plan;");
$planes = $query->result_array();
$plan_options = array();
foreach ($planes as $k => $v){
	$plan_options[$v['id_plan']] = $v['nombre'];
}

//busco todos los markers sin asociacion que sean Negocios/Farmacias
$query = $this->db->query("SELECT 
							 m.id_marker,
							m.name,
							m.aproved,
							m.description,
							m.marker_cat
							FROM marker as m
							LEFT outer join socio_marker as rel 
							on m.id_marker=rel.id_marker 
							WHERE rel.id_marker IS NULL and
								  m.aproved = 1 and
								  (m.marker_cat = 4 OR m.marker_cat = 7)  
							ORDER BY m.name;
						");
$marker_sa = $query->result_array();
$free_markers = array();
foreach ($marker_sa as $k => $v){
	$free_markers[$v['id_marker']] = str_replace('-', ' ', $v['name']);
}

?>
<div class='content centered'>
	<div style='margin-top: 25px;'>
	<div class='lheader plan' style='margin:0px 60px;'>
		<h2>Beneficios</h2>
		<ul>	
			<li><p class='color42 inline'>Actualiza</p> el contenido de tu negocio.</li>
		    <li><p class='color42 inline'>Mostra</p> fotos y promociones.</li>
		    <li><p class='color42 inline'>Ubica</p> tu negocio en el mapa interactivo.</li>
		    <li>Publicar en ConocePunta <p class='color42 inline'>no tiene costo</p>.</li>	    
	    </ul>
	    <h2>Mas Clientes</h2>
	    <ul>
	        <li>Atrae cientos de <p class='color42 inline'>nuevos clientes</p> a tu negocio.</li>
	        <li>Tu negocio puede compartirse en Facebook, </li>
	        <li>Twitter y otras redes sociales, estos canales son un <p class='color42 inline'>gran medio de difusion</p>.</li>
	    </ul>
	</div>
	</ul>
	</div>
	<div class='lheader contact_side' style=' margin:0px 60px;'>
<?php 
$attributes = array('class' => '', 'id' => 'socio');
echo form_open('socios', $attributes); ?>

<div>
        <!--<label for="name">Nombre <span class="required">*</span></label><br />-->
        <?php //echo form_error('name'); ?>
        <input placeholder="*Nombre" id="name" type="text" name="name"  value="<?php echo set_value('name');?>" class="input regular-text, validate[required, custom[onlyLetterNumber]]" />
</div>

<div>
        <!-- <label for="email">Email <span class="required">*</span></label><br /> -->
        <?php //echo form_error('email'); ?>
        <input placeholder="*Email" id="email" type="text" name="email"  value="<?php echo set_value('email'); ?>"  class="input regular-text, validate[required, custom[email]]"/>
</div>

<div>
        <!-- <label for="telephone">Telefono</label><br /> -->
        <?php //echo form_error('telephone'); ?>
        <input  placeholder="Telefono" id="telephone" type="text" name="telephone"  value="<?php echo set_value('telephone'); ?>"  class="input regular-text, validate[custom[phone]]"/>
</div>
<p class='separator'></p>
<div>
        <!-- <label for="id_plan">Plan <span class="required">*</span></label><br /> -->
        <?php //echo form_error('id_plan'); ?>
        
        <?php 
        	echo form_dropdown('id_plan', $plan_options, set_value('id_plan'), 'class="input" disabled="disabled"')
        	//echo form_dropdown('id_plan', $plan_options, set_value('id_plan'), 'class="input"')
        ?>
</div>                                             
<div>
        <label for="id_marker">Negocio <span class="required">*</span></label><br />
        <?php //echo form_error('id_plan'); ?>
        
        <?php
        		if($_POST['id_marker']){
        			$free_markers = array();
        			$free_markers[$_POST['id_marker']] = str_replace('-', ' ', $_POST['marker_name']);
        			echo form_dropdown('id_marker', $free_markers, set_value('id_marker'), 'class="input"');
        		}else{
        			echo form_dropdown('id_marker', $free_markers, set_value('id_marker'), 'class="input"');
        		}
         ?>
</div> 
<!--                     
<div>
        <label for="marker_name">Nuevo</label>
        <?php //echo form_error('marker_name'); ?>        
        <?php echo form_checkbox('','',TRUE,'id="new_marker" class="input"') ?>
</div>

<div>
        <label for="marker_name">Nombre del Negocio <span class="required">*</span></label>
        <?php //echo form_error('marker_name'); ?>
        <br /><input id="marker_name" type="text" name="marker_name"  value="<?php echo set_value('marker_name'); ?>"  class="input regular-text, validate[required]"/>
</div>
<div>
        <label for="marker_address">Direcci&oacute;n del Negocio <span class="required">*</span></label>
        <?php //echo form_error('marker_address'); ?>
        <br /><input id="marker_address" type="text" name="marker_address"  value="<?php echo set_value('marker_address'); ?>"  class="input regular-text, validate[required]"/>
</div>
<div>
        <label for="marker_city">Ciudad <span class="required">*</span></label>
        <?php //echo form_error('marker_city'); ?>
        <br /><input id="marker_city" type="text" name="marker_city" value="<?php echo set_value('marker_city'); ?>"  class="input regular-text, validate[required]"/>
</div>
 
<div>
        <label for="marker_description">Descripci&oacute;n <span class="required">*</span></label>
		<?php //echo form_error('marker_description'); ?>
		<br />
							
		<?php echo form_textarea( array( 'name' => 'marker_description', 'rows' => '10', 'cols' => '35', 'class' => 'input regular-text, validate[required]', 'value' => set_value('marker_description') ) )?>
</div>
-->
<div><?php echo form_submit( 'submit', 'Asociarse', 'class="submit"'); ?></div>

<?php echo form_close(); ?>
</div>

</div>
<script type='text/javascript'>
	$('#socio').validationEngine('attach');
</script>      
